export const getInputs = () => [
	[
		[
			[1, 2, 3],
			[4, 5, 6],
			[7, 8, 9],
		],
	],
	[
		[
			[1, 2, 3, 4],
			[5, 6, 7, 8],
			[9, 10, 11, 12],
		],
	],
	[
		[
			[1, 2, 3, 4],
			[5, 6, 7, 8],
			[9, 10, 11, 12],
			[13, 14, 15, 16],
		],
	],
];

/**
 * **[54. 螺旋矩阵](https://leetcode.cn/problems/spiral-matrix/)**
 *
 * 给你一个 `m` 行 `n` 列的矩阵 `matrix` ，请按照 **顺时针螺旋顺序** ，返回矩阵中的所有元素。
 *
 * **示例 1：**
 *
 * ![](https://assets.leetcode.com/uploads/2020/11/13/spiral1.jpg)
 *
 * ```
 * 输入：matrix = [[1,2,3],[4,5,6],[7,8,9]]
 * 输出：[1,2,3,6,9,8,7,4,5]
 * ```
 *
 * **示例 2：**
 *
 * ![](https://assets.leetcode.com/uploads/2020/11/13/spiral.jpg)
 *
 * ```
 * 输入：matrix = [[1,2,3,4],[5,6,7,8],[9,10,11,12]]
 * 输出：[1,2,3,4,8,12,11,10,9,5,6,7]
 * ```
 *
 * @param matrix
 * @returns
 */
export default function (matrix: number[][]): number[] {
	const m = matrix.length,
		n = matrix[0].length;
	const halfM = Math.ceil(m / 2),
		halfN = Math.floor(n / 2);
	const res: number[] = [];

	// TODO:
	// const right = (i: number, j: number) => {
	// 	let y = j;

	// 	while (i + y < n) {
	// 		res.push(matrix[i][y++]);
	// 	}
	// 	down(i + 1, y - 1);
	// };
	// const down = (i: number, j: number) => {
	// 	let x = i;

	// 	while (x + n - j - 1 < m) {
	// 		res.push(matrix[x++][j]);
	// 	}
	// 	left(x - 1, j - 1);
	// };
	// const left = (i: number, j: number) => {
	// 	let y = j;
	// 	while (y > m - i) {
	// 		res.push(matrix[i][y--]);
	// 	}
	// 	if (i - 1 > halfM) return;
	// 	up(i - 1, y + 1);
	// };
	// const up = (i: number, j: number) => {
	// 	let x = i;
	// 	while (x > n - j) {
	// 		res.push(matrix[x--][j]);
	// 	}
	// 	if (j + 1 < halfN) return;
	// 	console.log(x + 1, j);
	// 	// right(x - 1, j + 1);
	// };

	// right(0, 0);
	return res;
}
